package com.xl333.util;

import java.io.File;
import java.io.FileOutputStream;

/**
 * @author 七月的狮子
 * @date 2020/5/25
 */
public class FileUtil {

    public static void createFile(String filePath, String fileName, String content){
        File file = new File(filePath + fileName);
        File parentFile = file.getParentFile();
        if(!parentFile.exists()){
            parentFile.mkdirs();
        }

        FileOutputStream os = null;
        try {
            file.createNewFile();
            os = new FileOutputStream(file);
            os.write(content.getBytes("UTF-8"));
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(os != null){
                try{
                    os.close();
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
    }

}
